import request from '@/utils/request';

// 获取当前用户名
export async function viewBaseInfo(params: any) {
  return request('/api/user/viewBaseInfo', {
    method: 'POST',
    data: params,
  });
}

// 工艺指导书上传
export async function uploadGuideBookFileInfo2(para:any){
  return request('/api/product/uploadGuideBookFileInfo2',{
    method: 'POST',
    requestType: 'form', 
    // headers: {
    //   'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundaryX72QZDdfwlF5U73J;application/x-www-form-urlencoded',
    // },
    data: para.file,
    params: {
      batchProductId: para.batchProductId,
      instruction: para.instruction,
      uploadTime: para.uploadTime,
      uploaderId: para.uploaderId,
      uploaderName: para.uploaderName,
    }
  });
}

export async function getProductManufactByPage(params: any) {
  return request('/api/product/getProductManufactByPage', {
    method: 'POST',
    data: params,
  });
}

//更新时间updateProductManufactInfor
export async function updateProductManufactInfor(params: any) {
  return request('/api/product/updateProductManufactTime', {
    method: 'POST',
    data: params,
  });
}

///project/getBatchPlanByPage
export async function getBatchPlanByPage(params: any) {
  return request('/api/project/getBatchPlanByPage', {
    method: 'POST',
    data: params,
  });
}

///product/getWorkOrderInforByBatchPlanId
export async function getWorkOrderInforByBatchPlanId(params: any) {
  return request('/api/product/getWorkOrderInforByBatchPlanId', {
    method: 'POST',
    params: {
      batchPlanId: params,
    },
  });
}

///api/product/autoScheduleByBatchPlanId
export async function autoScheduleByBatchPlanId(params: any) {
  return request('/api/product/autoScheduleByBatchPlanId', {
    method: 'POST',
    params: {
      batchPlanId: params,
    },
  });
}

export async function autoScheduleByWoId(para:any) {
  return request('/api/product/autoScheduleByWoId',{
    method: 'POST',
    params: {
      woId: para,
    },
  });
}

export async function autoScheduleByBatchWoId(para:any){
  return request('/api/product/autoScheduleByBatchWoId',{
    method: 'POST',
    params: {
      woIds: para,
    },
  });
}

//批量排程后释放工单
export async function scheduleByWoIds(params: any){
  return request('/api/product/scheduleByWoIds',{
    method:'POST',
    data:params,
  })
}

//product/getProductPlansByWoId  product/scheduleByWoIds
export async function getProductPlansByWoId(params: any) {
  return request('/api/product/getProductPlansByWoId', {
    method: 'POST',
    params: {
      woId: params,
    }
  });
}

export async function getStageByinfoId(params:any){
  return request('/api/project/getStageByinfoId', {
    method:'POST',
    params: {
      infoId: params,
    }
  })
}

//获取项目id获取各阶段信息bybatchPlanId
export async function getStageByBatchPlanId(params: any){
  return request('/api/project/getStageByBatchPlanId',{
    method:'POST',
    params:{
      batchPlanId: params,
    }
  })
}

//计划变更/product/updateProductPlanTime
export async function updateProductPlanTime(params: any) {
  return request('/api/product/updateProductPlanTime', {
    method: 'POST',
    data: params,
  });
}

///api/product/getWorkOrderInforByBatchPlanIdAndUnscheduled
export async function getWorkOrderInforByBatchPlanIdAndUnscheduled(params: any) {
  return request('/api/product/getWorkOrderInforByBatchPlanIdAndUnscheduled', {
    method: 'POST',
    params: {
      batchPlanId: params,
    },
  });
}

//getWo/api/product/getWorkOrderInforByBatchPlanIdAndScheduled
export async function getWorkOrderInforByBatchPlanIdAndScheduled(params: any) {
  return request('/api/product/getWorkOrderInforByBatchPlanIdAndScheduled', {
    method: 'POST',
    params: {
      batchPlanId: params,
    },
  });
}

//分页获取/api/product/getWorkOrderInforByPage
export async function getWorkOrderInforByPage(params: any) {
  return request('/api/product/getWorkOrderInforByPage', {
    method: 'POST',
    data: params,
  });
}

//手动排程/api/product/manualSchedule
export async function manualSchedule(params: any) {
  return request('/api/product/manualSchedule', {
    method: 'POST',
    data: params,
  });
}

//批量排程/api/product/autoScheduleByBatchPlanIds
export async function autoScheduleByBatchPlanIds(params: any) {
  return request('/api/product/autoScheduleByBatchPlanIds', {
    method: 'POST',
    data: params,
  });
}

export default {
  getProductManufactByPage,
  updateProductManufactInfor,
};
